ImageGear Java PDF > Getting Started > Samples |
ImageGear Java PDF provides the following samples to help get you started. They are located in the $HOME/Accusoft/ImageGearJavaPDF1-64/samples folder.
Please refer to the “How to Build and Run Samples” section below for help getting started with building the samples. |
Sample Name | This sample illustrates how to... |
Arguments Available (where [] indicates an optional argument) |
---|---|---|
AddImageSample | Add an image to a page of a PDF document. | <input_file_path> [<position> [<output_file_path>]] |
IGJavaInteroperabilitySample | Integrate ImageGearJava and ImageGearPDFJava libraries. To run this sample you are required to install ImageGear for Java. | <input_file_path> [<output_file_path>] |
ImageToPDFSample | Create a PDF document from an image. | <input_file_path> [<output_file_path>] |
InsertPagesSample | Insert pages from one PDF document into another PDF document. | <destination_file_path> <insert_at_page_number> <source_file_path> [<start_page_number> [<page_count>]] |
MergePDFSample | Merge two PDF documents. | <input_file_path1> <input_file_path2> [<output_file_path>] |
OpenSaveSample | Open and save a PDF document. | <input_file_path> [<output_file_path> [<save_with_LINEARIZED_flag>]] |
RenderSample | Open and render a PDF document to an image. | <input_file_path> [<page_number> [<output_file_path> [<resolution> [<smoothing_flags>]]]] |
SplitPDFSample | Split a PDF document. | <input_file_path> [<number_of_pages>] |
Copy Code | |
---|---|
java -jar RenderSample-1.1.jar "single-page.pdf" "single-page-output.pdf" |
The above command runs the RenderSample and specifies "single-page.pdf" as the <input_file_path>, "single-page-output.pdf" as the <output_file_path>. Note the <page_number>, <resolution>, and <smoothing_flags> aren't specified, so the default values are used.
For each sample you can also specify the -h command-line option, which will display an explanation of the different options available and how to use the sample.
This section describes how to build and run the code samples.
Copy Code | |
---|---|
cd $HOME/Accusoft/ImageGearJavaPDF1-64/samples/OpenSaveSample |
Copy Code | |
---|---|
mvn package |
After the command has successfully completed, the "target" folder will be created in the sample folder.
Copy Code | |
---|---|
java -jar ./target/OpenSaveSample-1.1.jar "../SampleData/Pdf/single-page.pdf" "../SampleData/Pdf/single-page-output.pdf" false |
Copy Code | |
---|---|
cd $HOME/Accusoft/ImageGearJavaPDF1-64/samples/OpenSaveSample |
Copy Code | |
---|---|
javac -classpath "../../java/IgPdf.jar" ./src/com/accusoft/samples/OpenSaveSample/OpenSaveSample.java |
Copy Code | |
---|---|
java -classpath "../../java/IgPdf.jar:./src/" com.accusoft.samples.OpenSaveSample.OpenSaveSample "../SampleData/Pdf/single-page.pdf" "../SampleData/Pdf/single-page-output.pdf" true |
To run the IGJavaInteroperabilitySample, use the following command:
where <ImageGearJava> is the folder where ImageGear for Java was installed. |